To improve the availability and expandability of devices and simplify device management, stacking technology has been developed and applied. Stacking technology connects two or more distributed switching devices to form a logical device, and users can manage the entire stack through the logical device. The switching devices in a stack are connected by stack links. A stack link can be one physical link or aggregated from multiple physical links. Stack management packets, data forwarding packets and high availability backup packets are transmitted over stack links. In application, stack aggregate links are adopted to improve the bandwidth and availability of the switching devices. In this case, physical ports connecting to the same neighbor need to be configured as a stack port. This stack port is a logical port aggregated from multiple physical ports.
Currently, stack ports are manually configured. A physical port enabled with the stacking function is manually added to a stack port according to the connection status of the stack links between switching devices. This manual stack port configuration method increases the configuration work load of administrators and increases the possibility of configuration errors when there are many physical ports. An example of incorrectly configured physical ports and stack ports associated with a stack configuration is shown in FIG. 1. In the example, physical port 1 on switching device 2 is a common service port not enabled with the stacking function, but the administrator adds the physical port to stack port 1; also, a stack link exists between physical port 3 on switching device 2 and switching device 1, and the physical port should be added to stack port 1, but the administrator adds the physical port to stack port 2 connecting to switching device 3. These wrong configurations may cause stack establishment failure, device failure or stack loop, cause the stack unable to operate normally.